ErrorNotification = {

	notificationBox: null,
	notificationMessage: null,
	regexp: new RegExp("$"),
	
	initialize: function(){		
		this.notificationBox = $("#ajaxErrorNotification");
		this.notificationBox.ajaxError(this.onAjaxErrorEventHandler);
		this.notificationBox.click(this.onNotificationClickEventHandler);
		this.notificationMessage = $("#ajaxErrorMessage");
	},
	
	onAjaxErrorEventHandler: function(event, request, settings, error)
	{
		
		if(request.status == 401 || request.status == 403)
		{
			var response = $.parseJSON(request.responseText);
			if(response.reason)
				ErrorNotification.showAjaxErrorNotification(response.reason);
		}
	},
	
	showAjaxErrorNotification : function(message)
	{
		ErrorNotification.notificationMessage.text(message);
		
		ErrorNotification.notificationBox.show('drop', {}, 500, function(){
			setTimeout(function(){
				ErrorNotification.hideNotification();
			}, 10000);
		});
	},

	hideNotification: function(){
		ErrorNotification.notificationBox.hide('drop', {}, 500);
	},
	
	onNotificationClickEventHandler : function(){
		ErrorNotification.hideNotification();
	}
};